{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "view-in-github"
   },
   "source": [
    "<a href=\"https://colab.research.google.com/github/henrygas/ctr/blob/master/0_ctr_data_explore.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "Qlbm7zd08GOz"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 10000 entries, 0 to 9999\n",
      "Data columns (total 24 columns):\n",
      "id                  10000 non-null uint64\n",
      "click               10000 non-null int64\n",
      "hour                10000 non-null int64\n",
      "C1                  10000 non-null int64\n",
      "banner_pos          10000 non-null int64\n",
      "site_id             10000 non-null object\n",
      "site_domain         10000 non-null object\n",
      "site_category       10000 non-null object\n",
      "app_id              10000 non-null object\n",
      "app_domain          10000 non-null object\n",
      "app_category        10000 non-null object\n",
      "device_id           10000 non-null object\n",
      "device_ip           10000 non-null object\n",
      "device_model        10000 non-null object\n",
      "device_type         10000 non-null int64\n",
      "device_conn_type    10000 non-null int64\n",
      "C14                 10000 non-null int64\n",
      "C15                 10000 non-null int64\n",
      "C16                 10000 non-null int64\n",
      "C17                 10000 non-null int64\n",
      "C18                 10000 non-null int64\n",
      "C19                 10000 non-null int64\n",
      "C20                 10000 non-null int64\n",
      "C21                 10000 non-null int64\n",
      "dtypes: int64(14), object(9), uint64(1)\n",
      "memory usage: 1.8+ MB\n",
      "None\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "data_path = \"./data/train.csv\"\n",
    "chunks = pd.read_csv(data_path, iterator=True)\n",
    "chunk = chunks.get_chunk(10000)\n",
    "print(type(chunk))\n",
    "print(chunk.info())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_part_path = \"./data/train_part.csv\"\n",
    "chunk.to_csv(data_part_path, index=False, header=True)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "include_colab_link": true,
   "name": "0_ctr_data_explore.ipynb",
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
